package com.bank;

import javax.swing.*;

public class Account {
    private String name;
    private int id;
    private String kind;
    private String password;
    private double balance;
    private String record;
    public Account(String name, int id, String kind, String password, double balance, String record) {
        this.name = name;
        this.id = id;
        this.kind = kind;
        this.password = password;
        this.balance = balance;
        this.record = record;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getKind() {
        return kind;
    }
    public void setKind(String kind) {
        this.kind = kind;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public double getBalance() {
        return balance;
    }
    public void setBalance(double balance) {
        this.balance = balance;
    }
    public String getRecord() {
        return record;
    }
    public void setRecord(String record) {
        this.record = record;
    }
    public void credit(double amount){
        balance+=amount;
    }
    public boolean debit(double amount){
        if(amount>balance){
            JOptionPane.showMessageDialog(null, "余额不足", "警告",JOptionPane.WARNING_MESSAGE);
            return false;
        }
        else{
            balance-=amount;
            return true;
        }
    }
}
